<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/template_clear.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:define name="title">
        <h:outputText value="#{bundle.CreatecurrentTitle}"></h:outputText>
    </ui:define>
    <ui:define name="body">
        <h:form id="form" styleClass="form" >
            <br/>
            <br/>
            <p:commandButton value="Upload More" action="UpFile?faces-redirect=true"/>
            <p:spacer width="10"/>
            <p:commandButton value="Clear Files" actionListener="#{projectController.deleteFiles()}" update=":form:" rendered="#{not empty projectController.tmpfiles}"/>
            <p:spacer width="10"/>
            <p:commandButton onclick="window.close();" value="Close"/>
            <p:fieldset legend="Current Files">
                <p:dataGrid id="files" var="f"  value="#{projectController.tmpfiles}" emptyMessage="No Files found">
                    <center>
                        <p:column>
                            <p:commandLink id="cur_file" value="#{f.name}" >
                                <p:tooltip for="cur_file">
                                    <h:outputText value="File Size:"  styleClass="label"/>
                                    <h:outputText value=" #{f.length()/1024} Kb"  />
                                    <br/>
                                    <h:outputText value="Uploaded in:"   styleClass="label"/>
                                    <h:outputText value=" #{f.lastModified()}"  />
                                </p:tooltip>
                            </p:commandLink>

                            <p:menu position="dynamic" trigger="cur_file" my="left top" at="left bottom"  >
                                <p:submenu label="File" rendered="true">
                                    <p:menuitem id="downLink" icon="ui-icon-search" value="Download" ajax="false"   >
                                        <p:fileDownload value="#{projectController.convertFile2(f)}"  />
                                    </p:menuitem>
                                    <p:menuitem id="view" icon="ui-icon-view"   value="View"  ajax="false" >
                                        <p:fileDownload value="#{projectController.convertFile2(f)}" contentDisposition="inline"    />
                                    </p:menuitem>
                                    <p:menuitem id="rem" icon="ui-icon-close" value="Remove"  actionListener="#{projectController.deleteFile(f)}"  update=":form:" />
                                </p:submenu>
                            </p:menu>
                        </p:column>
                    </center>
                </p:dataGrid>

                <p:commandLink id="save_file" value="Save" actionListener="#{projectController.importContigs(projectController.tmpfiles,userController.loggedUser)}"  update=":form:" process="@form">
                </p:commandLink>
                <p:separator/>
                <p:dataList value="#{projectController.tmp_list_fasta}"
                            var="file"
                            >
                    <p:column>
                        <h:outputText value="Fasta"  />
                    </p:column>
                    <p:column >
                        <p:commandLink id="cur_file"  >
                            <div class="item_on_list" >
                                <h:outputText value="#{file.defline}"  />

                            </div>
                            <p:menu position="dynamic" trigger="cur_file" my="left top" at="left bottom"  >
                                <p:submenu label="File" rendered="true">
                                    <p:menuitem id="rem" icon="ui-icon-close" value="Remove"  actionListener="#{projectController.deleteFileFasta(file)}"  update="@form" />
                                </p:submenu>
                            </p:menu>
                        </p:commandLink>
                    </p:column>
                </p:dataList>
                <p:dataList value="#{projectController.tmp_list_gb}"
                            var="genbank"
                            >
                    <p:column>
                        <h:outputText value="Fasta"  />
                    </p:column>
                    <p:column>
                        <h:outputText value=" #{genbank.definition}"  />
                    </p:column>
                </p:dataList>
            </p:fieldset>
        </h:form>
    </ui:define>
</ui:composition>


